package lab02.Test11;

/**
 * Created by Administrator on 2017/10/21.
 */
public class Square extends Rectangle {//定义正方形类并且继承矩形类
    double c;

    Square(double a, double b) {
        super(a, b);
    }

    public void diagonal() {
        c = Math.sqrt(length * width + length * width);
        System.out.println("对角线：" + c);
    }

    public static void main(String[] args) {
        Square S = new Square(6, 6);
        System.out.println(S.getClass().getName()+"正方形");
        S.printMyWay();
        S.diagonal();
    }
}

